<?php

namespace App\Notifications\Wechat;

use App\Internals\UserInternal;

class CourseStart extends Notification
{
    public function notify($userId, $courseLevel, $datetime, $seriesName)
    {
        $templateId = 'RhtSGisRFT5H9LjfMnZF3At2k6Niip8O2kPiCQyQgOU';
        $socialAccount = UserInternal::getSocialAccount($userId);
        $url = config('app.base_url') . '/?#/menu/course';
        $data = [
            'userName'   => $socialAccount['nickname'],
            'courseName' => [sprintf('%s - Level%s课程', $seriesName, $courseLevel), '#FF6F6F'],
            'date'       => [' ' . $datetime . ' ', '#FF6F6F'],
            'remark'     => ["\n温馨提示：已向您推送了一本绘本供免费体验，请点击“我的课程”查阅哦！", '#FF6F6F'],
        ];
        $this->send($socialAccount['openId'], $templateId, $url, $data);
    }
}
